package com.usian.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.usian.mapper.AiadesMapper;
import com.usian.model.aiades.entity.AiadesShow;
import com.usian.model.aiades.from.AiadesFrom;
import com.usian.model.aiades.from.ClassifyFrom;
import com.usian.service.AiadesService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class AiadesServiceImpl extends ServiceImpl<AiadesMapper, AiadesShow> implements AiadesService {
    @Resource
    private AiadesMapper aiadesMapper;


    @Override
    public List<AiadesShow> findaiades(AiadesFrom aiades) {
        LambdaQueryWrapper<AiadesShow> qr = new LambdaQueryWrapper<>();
        if (aiades.getClassifyId()!=null){
            qr.eq(AiadesShow::getClassifyId,aiades.getClassifyId());
        }
        if (aiades.getCreateId()!=null){
            qr.eq(AiadesShow::getCreateId,aiades.getCreateId());
        }
        List<AiadesShow> list = aiadesMapper.selectList(qr);
        return list;
    }

    @Override
    public List<AiadesShow> findaiades2(ClassifyFrom classify) {
        LambdaQueryWrapper<AiadesShow> qr = new LambdaQueryWrapper<>();
        if (classify.getClassifyid()!=null){
            qr.eq(AiadesShow::getClassifyId,classify.getClassifyid());
        }
        List<AiadesShow> list = aiadesMapper.selectList(qr);
        return list;
    }

    @Override
    public List<AiadesShow> findsearch(String searchText) {
        List<AiadesShow> list = aiadesMapper.findsearch(searchText);
        return list;
    }
}
